package com.xk.androiddemo.database;



import androidx.annotation.NonNull;
import androidx.room.ColumnInfo;
import androidx.room.Entity;
import androidx.room.PrimaryKey;




@Entity(tableName = "users")
public class UserBean {


    @ColumnInfo(name = "phone")
    private String phone;



    @ColumnInfo(name = "pwd")
    private String pwd;
    @NonNull
    @PrimaryKey
    private String name = "";


    @ColumnInfo(name = "path")
    private String path="";

    // 保留所有参数的构造函数，Room可以使用它来创建实体对象
    public UserBean(String phone, String pwd, String name, String path) {
        this.phone = phone;
        this.pwd = pwd;
        this.name = name;
        this.path = path;
    }

    // 为了Room，你通常需要一个无参数的构造函数
    public UserBean() {
    }

    // Getter和Setter方法




    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPath() {
        if(path==null){
            return "";
        }
        return path;
    }

    public void setPath(String path) {
            this.path =path;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getPwd() {
        return pwd;
    }

    public void setPwd(String pwd) {
        this.pwd = pwd;
    }

    // toString方法保持不变
    @Override
    public String toString() {
        return "UserBean{" +
                "phone='" + phone + '\'' +
                ", pwd='" + pwd + '\'' +
                ", name='" + name + '\'' +
                ", path='" + path + '\'' +
                '}';
    }
}